package com.rotten;

import imageLoader.DrawableManager;
import android.app.Activity;
import android.net.NetworkInfo.DetailedState;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

public class FullScreenIMG extends Activity {
	private String title;
	private String link_img;
	private int audience = 0;
	private int critics = 0;
	ImageView img;
	DrawableManager draw = new DrawableManager();
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //full screen
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);              
        Bundle extras = getIntent().getExtras(); 
        if(extras !=null)
        {
        title = extras.getString("title");
        link_img = extras.getString("link_img");
        audience = extras.getInt("audience");
        critics = extras.getInt("critics");
        }                
        setContentView(R.layout.fullscreen_img);
        
        //Substitui os valores
        TextView t = (TextView) findViewById(R.id.full_title);
        TextView a = (TextView) findViewById(R.id.full_audience);
        TextView c = (TextView) findViewById(R.id.full_critics);
        img = (ImageView) findViewById(R.id.full_img);
        
        t.setText(title);
        
      //se tive menos de 60 muda a imgagen
        ImageView cc = (ImageView) findViewById(R.id.full_critics_img);
        if(critics < 60)
        	cc.setImageResource(R.drawable.rotten);
        if(critics >= 95)
        	cc.setImageResource(R.drawable.superfresh);
        
        if(critics<0)
        	c.setText("? %");
        else c.setText(critics + "%");
        a.setText(audience +"%");
        
        draw.fetchDrawableOnThread(link_img, img);
	}
}